<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of the routes that are handled
| by your application. Just tell Laravel the URIs it should respond
| to using a Closure or controller method. Build something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});

//Auth::routes();

Route::get('/home', ['as'=>'admin.home','uses'=>'HomeController@index']);
//访问权限
Route::group(['namespace' => 'Access'], function () {
    Route::get('/access/permissions', ['as'=>'admin.access.permissions','uses'=>'PermissionController@index']);
    Route::get('/access/permissions/create', ['as'=>'admin.access.permissions.create','uses'=>'PermissionController@create']);
    Route::post('/access/permissions/store', ['as'=>'admin.access.permissions.store','uses'=>'PermissionController@store']);
    Route::get('/access/permissions/{id}/edit', ['as'=>'admin.access.permissions.edit','uses'=>'PermissionController@edit']);
    Route::put('/access/permissions/{id}/update', ['as'=>'admin.access.permissions.update','uses'=>'PermissionController@update']);
    Route::delete('/access/permissions/{id}', ['as'=>'admin.access.permissions.destroy','uses'=>'PermissionController@destroy']);

    Route::get('/access/roles', ['as'=>'admin.access.roles','uses'=>'RoleController@index']);
    Route::get('/access/roles/{id}/permissions', ['as'=>'admin.access.roles.permissions','uses'=>'RoleController@permissions']);
    Route::post('/access/roles/{id}/permissions', ['as'=>'admin.access.roles.permissions','uses'=>'RoleController@storePermissions']);
    Route::get('/access/roles/create', ['as'=>'admin.access.roles.create','uses'=>'RoleController@create']);
    Route::post('/access/roles/store', ['as'=>'admin.access.roles.store','uses'=>'RoleController@store']);
    Route::get('/access/roles/{id}/edit', ['as'=>'admin.access.roles.edit','uses'=>'RoleController@edit']);
    Route::put('/access/roles/{id}/update', ['as'=>'admin.access.roles.update','uses'=>'RoleController@update']);
    Route::delete('/access/roles/{id}', ['as'=>'admin.access.roles.destroy','uses'=>'RoleController@destroy']);

    Route::get('/access/users', ['as'=>'admin.access.users','uses'=>'UserController@index']);
    Route::get('/access/users/{id}/edit', ['as'=>'admin.access.users.edit','uses'=>'UserController@edit']);
    Route::put('/access/users/{id}/update', ['as'=>'admin.access.users.update','uses'=>'UserController@update']);
    Route::delete('/access/users/{id}', ['as'=>'admin.access.users.destroy','uses'=>'UserController@destroy']);
    Route::get('/access/users/{id}/permissions', ['as'=>'admin.access.users.permissions','uses'=>'UserController@permissions']);
    Route::post('/access/users/{id}/permissions', ['as'=>'admin.access.users.permissions','uses'=>'UserController@storePermissions']);

});


Route::group(['namespace' => 'Assistant'], function () {
    
    Route::get('/assistant/sms', ['as' => 'admin.assistant.sms', 'uses' => 'SmsController@index']);
    Route::get('/assistant/articles', ['as' => 'admin.assistant.articles', 'uses' => 'ArticleController@index']);
    Route::get('/assistant/articles/create', ['as' => 'admin.assistant.articles.create', 'uses' => 'ArticleController@create']);
    Route::post('/assistant/articles/create', ['as' => 'admin.assistant.articles.create', 'uses' => 'ArticleController@store']);
    Route::get('/assistant/articles/{id}/edit', ['as' => 'admin.assistant.articles.edit', 'uses' => 'ArticleController@edit']);
    Route::post('/assistant/articles/{id}/edit', ['as' => 'admin.assistant.articles.edit', 'uses' => 'ArticleController@update']);
    Route::delete('/assistant/articles/{id}', ['as' => 'admin.assistant.articles.destroy', 'uses' => 'ArticleController@destroy']);
});

Route::group(['namespace' => 'Member'], function () {
    Route::get('/member', ['as' => 'admin.member', 'uses' => 'MemberController@index']);
    Route::get('/member/{id}/edit', ['as' => 'admin.member.edit', 'uses' => 'MemberController@edit']);
    Route::put('/member/{id}/edit', ['as' => 'admin.member.edit', 'uses' => 'MemberController@update']);
    Route::get('/member/{id}/balance', ['as' => 'admin.member.balance', 'uses' => 'MemberController@balance']);
    Route::put('/member/{id}/balance', ['as' => 'admin.member.balance', 'uses' => 'MemberController@updateBalance']);
    Route::get('/member/{id}/subs', ['as' => 'admin.member.subs', 'uses' => 'MemberController@subs']);
});

Route::group(['namespace' => 'Shop'], function () {
    Route::get('/shop/option', ['as' => 'admin.shop.option', 'uses' => 'OptionController@index']);
    Route::get('/shop/option/create', ['as' => 'admin.shop.option.create', 'uses' => 'OptionController@create']);
    Route::post('/shop/option/create', ['as' => 'admin.shop.option.create', 'uses' => 'OptionController@store']);
    Route::get('/shop/option/{id}/edit', ['as' => 'admin.shop.option.edit', 'uses' => 'OptionController@edit']);
    Route::post('/shop/option/{id}/edit', ['as' => 'admin.shop.option.edit', 'uses' => 'OptionController@update']);
    Route::delete('/shop/option/{id}/destroy', ['as' => 'admin.shop.option.destroy', 'uses' => 'OptionController@destroy']);

    Route::get('/shop/order', ['as' => 'admin.shop.order', 'uses' => 'OrderController@index']);
});

Route::group(['namespace' => 'Finance'], function () {
    //Route::resource('/shop/option', 'OptionController');
    Route::get('/finance/recharge', ['as' => 'admin.finance.recharge', 'uses' => 'RechargeController@index']);
    Route::get('/finance/commission', ['as' => 'admin.finance.commission', 'uses' => 'CommissionController@index']);
    Route::post('/finance/commission/settle', ['as' => 'admin.finance.commission.settle', 'uses' => 'CommissionController@settle']);
    Route::post('/finance/commission/settle/all', ['as' => 'admin.finance.commission.settle.all', 'uses' => 'CommissionController@settleAll']);
   
    Route::post('/finance/commission/cancel', ['as' => 'admin.finance.commission.cancel', 'uses' => 'CommissionController@cancel']);
    Route::get('/finance/withdrawals', ['as' => 'admin.finance.withdrawals', 'uses' => 'WithdrawalsController@index']);
    Route::get('/finance/withdrawals/{id}/transfer', ['as' => 'admin.finance.withdrawals.transfer', 'uses' => 'WithdrawalsController@transfer']);
    Route::get('/finance/withdrawals/{id}/enterprise', ['as' => 'admin.finance.withdrawals.enterprise', 'uses' => 'WithdrawalsController@enterprise']);
    Route::get('/finance/withdrawals/{id}/back', ['as' => 'admin.finance.withdrawals.back', 'uses' => 'WithdrawalsController@back']);

    Route::get('/finance/financialdetails', ['as' => 'admin.finance.financialdetails', 'uses' => 'FinancialDetailsController@index']);

});

Route::group(['namespace' => 'Wechat'], function () {
    
    Route::get('/wechat/menu/sysnc', ['as' => 'admin.wechat.menu.sysnc', 'uses' => 'MenuController@sysnc']);
    //Route::resource('/wechat/menu', 'MenuController');
    Route::get('/wechat/menu', ['as' => 'admin.wechat.menu', 'uses' => 'MenuController@index']);
    Route::get('/wechat/menu/create', ['as' => 'admin.wechat.menu.create', 'uses' => 'MenuController@create']);
    Route::post('/wechat/menu/store', ['as' => 'admin.wechat.menu.store', 'uses' => 'MenuController@store']);
    Route::get('/wechat/menu/{id}/edit', ['as' => 'admin.wechat.menu.edit', 'uses' => 'MenuController@edit']);
    //Route::get('/wechat/menu/{$id}/edit', ['as' => 'admin.wechat.menu.edit', 'uses' => function(){ echo 1;}]);
    Route::post('/wechat/menu/{id}/update', ['as' => 'admin.wechat.menu.update', 'uses' => 'MenuController@update']);

    Route::get('/wechat/menu/{id}/destroy', ['as' => 'admin.wechat.menu.destroy', 'uses' => 'MenuController@destroy']);

    Route::get('/wechat/material', ['as' => 'admin.wechat.material', 'uses' => 'MaterialController@index']);
    
    Route::get('/wechat/reply/news', ['as' => 'admin.wechat.reply.news', 'uses' => 'ReplyController@news']);
    Route::get('/wechat/reply/create-text', ['as' => 'admin.wechat.reply.create-text', 'uses' => 'ReplyController@createText']);
    Route::get('/wechat/reply/create-news', ['as' => 'admin.wechat.reply.create-news', 'uses' => 'ReplyController@createNews']);
    Route::get('/wechat/reply/{id}/destroy', ['as' => 'admin.wechat.reply.destroy', 'uses' => 'ReplyController@destroy']);
    Route::post('/wechat/reply/destroyall', ['as' => 'admin.wechat.reply.destroy.all', 'uses' => 'ReplyController@destroyAll']);
    //Route::resource('/wechat/reply', 'ReplyController');
    Route::get('/wechat/reply', ['as' => 'admin.wechat.reply', 'uses' => 'ReplyController@index']);
    
    
    Route::get('/wechat/reply/{id}/edit', ['as' => 'admin.wechat.reply.edit', 'uses' => 'ReplyController@edit']);
    Route::post('/wechat/reply/{id}/update', ['as' => 'admin.wechat.reply.update', 'uses' => 'ReplyController@update']);
    
    Route::get('/wechat/reply/store', ['as' => 'admin.wechat.reply.store', 'uses' => 'ReplyController@store']);
    Route::post('/wechat/reply/store', ['as' => 'admin.wechat.reply.store', 'uses' => 'ReplyController@store']);
    
    //Route::resource('/wechat/reply', 'ReplyController');
});

Route::group(['namespace' => 'Stock'], function () {
    //Route::resource('/shop/option', 'OptionController');
    Route::get('/stock/activities', ['as' => 'admin.stock.activities', 'uses' => 'StockActivityController@index']);
    Route::get('/stock/activities/{id}', ['as' => 'admin.stock.activities.details', 'uses' => 'StockActivityController@details']);
    Route::get('/stock/orders', ['as' => 'admin.stock.orders', 'uses' => 'StockOrderController@index']);
    Route::get('/stock/orders/{id}/back', ['as' => 'admin.stock.orders.back', 'uses' => 'StockOrderController@back']);
});
